package me.sauce.folkpocket48.data.local.database.dao

import android.arch.lifecycle.LiveData
import android.arch.persistence.room.*
import io.reactivex.Flowable
import me.sauce.folkpocket48.data.local.database.entity.Member

/**
 * @author sauceWu .
 * @since 2017/12/21 12:08
 */
@Dao
interface MemberDao {

    @Query("SELECT * FROM member")
    fun queryAll(): Flowable<List<Member>>

    @Query("SELECT * FROM member")
    fun queryAllL(): LiveData<List<Member>>

    @Query("SELECT * FROM member WHERE member_name = (:name) LIMIT 1")
    fun findByName(name: String): Flowable<List<Member>>


    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insertAll(vararg member: Member) :LongArray

    @Delete
    fun delete(user: Member) :Int

}
